

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>配置 Ceph &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="通用选项" href="../common/" />
    <link rel="prev" title="存储设备" href="../storage-devices/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../">Ceph 存储集群</a></li>
          <li class="breadcrumb-item"><a href="../">配置</a></li>
      <li class="breadcrumb-item active">配置 Ceph</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/rados/configuration/ceph-conf.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../">配置</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../storage-devices/">存储设备</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">配置 Ceph</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id1">选项名</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">配置来源</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph-conf-file">配置段落</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph-metavariables">元变量</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id7">Ceph 配置文件</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph-conf-settings">配置文件段落</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph-conf-database">监视器配置数据库</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id13">帮助信息</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id14">运行时改配置</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id16">查看运行时配置</a></li>
<li class="toctree-l4"><a class="reference internal" href="#octopus">Octopus 版发生的变化</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../common/">通用选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-network-config">网络</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#id3">监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-osd-config">认证</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#osds">OSDs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#id5">心跳</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-logging-and-debugging">日志记录、调试</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-conf">ceph.conf 实例</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-runtime-config">跑多个集群（已废弃）</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network-config-ref/">网络选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../msgr2/">信使协议 v2</a></li>
<li class="toctree-l3"><a class="reference internal" href="../auth-config-ref/">认证选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mon-config-ref/">监视器选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mon-lookup-dns/">通过 DNS 查询监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mon-osd-interaction/">心跳选项（监视器与 OSD 的的交互）</a></li>
<li class="toctree-l3"><a class="reference internal" href="../osd-config-ref/">OSD 选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mclock-config-ref/">DmClock 配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../bluestore-config-ref/">BlueStore 配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../filestore-config-ref/">FileStore 配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../journal-ref/">日志选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pool-pg-config-ref/">存储池、归置组和 CRUSH 选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../general-config-ref/">常规选项</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../operations/">运维</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../man/">    手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="ceph">
<span id="configuring-ceph"></span><h1>配置 Ceph<a class="headerlink" href="#ceph" title="Permalink to this heading"></a></h1>
<p>你启动 Ceph 服务时，
初始化进程会把一系列守护进程放到后台运行。
<a class="reference internal" href="../../../glossary/#term-28"><span class="xref std std-term">Ceph 存储集群</span></a>运行三种守护进程：</p>
<ul class="simple">
<li><p><a class="reference internal" href="../../../glossary/#term-14"><span class="xref std std-term">Ceph 监视器</span></a> （ <code class="docutils literal notranslate"><span class="pre">ceph-mon</span></code> ）</p></li>
<li><p><a class="reference internal" href="../../../glossary/#term-11"><span class="xref std std-term">Ceph 管理器</span></a> （ <code class="docutils literal notranslate"><span class="pre">ceph-mgr</span></code> ）</p></li>
<li><p><a class="reference internal" href="../../../glossary/#term-19"><span class="xref std std-term">Ceph OSD 守护进程</span></a> （ <code class="docutils literal notranslate"><span class="pre">ceph-osd</span></code> ）</p></li>
</ul>
<p>支持 <a class="reference internal" href="../../../glossary/#term-8"><span class="xref std std-term">Ceph 文件系统</span></a>的 Ceph 存储集群至少运行着一个
<a class="reference internal" href="../../../glossary/#term-13"><span class="xref std std-term">Ceph 元数据服务器</span></a>（ <code class="docutils literal notranslate"><span class="pre">ceph-mds</span></code> ）。支持
<a class="reference internal" href="../../../glossary/#term-17"><span class="xref std std-term">Ceph 对象存储</span></a>的集群需运行 Ceph 网关守护进程（ <code class="docutils literal notranslate"><span class="pre">radosgw</span></code> ）。</p>
<p>各个守护进程都有一系列配置选项，各选项都有其默认值。
你可以更改这些配置选项，以调整系统行为。
覆盖默认值前应该深入理解可能产生的后果，
因为有可能显著降低集群的性能和稳定性。
还要注意后续版本的默认值可能会变，所以，
最好回顾一下与你的 Ceph 版本相对应的文档。</p>
<section id="id1">
<h2>选项名<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h2>
<p>Each of the Ceph configuration options has a unique name that consists of words
formed with lowercase characters and connected with underscore characters
(<code class="docutils literal notranslate"><span class="pre">_</span></code>).</p>
<p>When option names are specified on the command line, either underscore
(<code class="docutils literal notranslate"><span class="pre">_</span></code>) or dash (<code class="docutils literal notranslate"><span class="pre">-</span></code>) characters can be used interchangeable (e.g.,
<code class="docutils literal notranslate"><span class="pre">--mon-host</span></code> is equivalent to <code class="docutils literal notranslate"><span class="pre">--mon_host</span></code>).</p>
<p>When option names appear in configuration files, spaces can also be
used in place of underscore or dash.  We suggest, though, that for
clarity and convenience you consistently use underscores, as we do
throughout this documentation.</p>
</section>
<section id="id2">
<h2>配置来源<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p>每个 Ceph 守护进程、进程、和库都从好几个来源获取它的配置信息，
在下面列出了。列表里位于后面的会覆盖靠前的同一选项
（二者都存在的时候）。</p>
<ul class="simple">
<li><p>编译时内建的默认值</p></li>
<li><p>监视器集群的中央配置数据库</p></li>
<li><p>本地主机上的配置文件</p></li>
<li><p>环境变量</p></li>
<li><p>命令行参数</p></li>
<li><p>管理员在运行时覆盖的</p></li>
</ul>
<p>一个 Ceph 进程启动时有很多事，其中的第一步就是分析命令行、
环境变量和本地配置文件提供的配置选项。之后它会联系监视器集群，
以获取它为整个集群集中存储的配置信息。获取到整个配置的完整视图之后，
守护进程或者进程的启动就会继续。</p>
<section id="bootstrap-options">
<span id="id3"></span><h3>自举引导选项<a class="headerlink" href="#bootstrap-options" title="Permalink to this heading"></a></h3>
<p>Bootstrap options are configuration options that affect the process’s ability
to contact the monitors, to authenticate, and to retrieve the cluster-stored
configuration.  For this reason, these options might need to be stored locally
on the node, and set by means of a local configuration file. These options
include the following:</p>
<dl class="std confval">
<dt class="sig sig-object std" id="confval-mon_host">
<span class="sig-name descname"><span class="pre">mon_host</span></span><a class="headerlink" href="#confval-mon_host" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>This is a list of IP addresses or hostnames that are separated by
commas, whitespace, or semicolons. Hostnames are resolved via DNS. All
A and AAAA records are included in the search list.</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-mon_host_override">
<span class="sig-name descname"><span class="pre">mon_host_override</span></span><a class="headerlink" href="#confval-mon_host_override" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>This is the list of monitors that the Ceph process <strong>initially</strong>
contacts when first establishing communication with the Ceph cluster.
This overrides the known monitor list that is derived from MonMap
updates sent to older Ceph instances (like librados cluster handles).
This option is expected to be useful primarily for debugging.</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<ul class="simple">
<li><p><a class="reference internal" href="../mon-lookup-dns/#confval-mon_dns_srv_name"><code class="xref std std-confval docutils literal notranslate"><span class="pre">mon_dns_srv_name</span></code></a></p></li>
<li><p><a class="reference internal" href="../mon-config-ref/#confval-mon_data"><code class="xref std std-confval docutils literal notranslate"><span class="pre">mon_data</span></code></a>, <a class="reference internal" href="../osd-config-ref/#confval-osd_data"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_data</span></code></a>, <code class="xref std std-confval docutils literal notranslate"><span class="pre">mds_data</span></code>,
<a class="reference internal" href="../../../mgr/administrator/#confval-mgr_data"><code class="xref std std-confval docutils literal notranslate"><span class="pre">mgr_data</span></code></a>, and similar options that define which local directory
the daemon stores its data in.</p></li>
<li><p><code class="xref std std-confval docutils literal notranslate"><span class="pre">keyring</span></code>, <code class="xref std std-confval docutils literal notranslate"><span class="pre">keyfile</span></code>, and/or <code class="xref std std-confval docutils literal notranslate"><span class="pre">key</span></code>, which can be
used to specify the authentication credential to use to authenticate with the
monitor. Note that in most cases the default keyring location is in the data
directory specified above.</p></li>
</ul>
<p>大多数情况下，这些选项的默认值都是恰当的。有一个例外：
用于指示集群监视器地址的 <a class="reference internal" href="#confval-mon_host"><code class="xref std std-confval docutils literal notranslate"><span class="pre">mon_host</span></code></a>  选项。
<a class="reference internal" href="../mon-lookup-dns/#mon-dns-lookup"><span class="std std-ref">使用 DNS 来查找监视器</span></a>时，
可以完全忽视本地配置文件。</p>
</section>
<section id="id4">
<h3>跳过监视器配置<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h3>
<p>给进程加 <code class="docutils literal notranslate"><span class="pre">--no-mon-config</span></code> 选项之后，
它就会不会向集群的监视器们索要配置信息了。
在某些时候需要用到，比如完全靠配置文件管理配置信息时、
或者监视器集群挂了却需要进行一些维护活动。</p>
</section>
</section>
<section id="ceph-conf-file">
<span id="id5"></span><h2>配置段落<a class="headerlink" href="#ceph-conf-file" title="Permalink to this heading"></a></h2>
<p>Each of the configuration options associated with a single process or daemon
has a single value. However, the values for a configuration option can vary
across daemon types, and can vary even across different daemons of the same
type. Ceph options that are stored in the monitor configuration database or in
local configuration files are grouped into sections — so-called “configuration
sections” — to indicate which daemons or clients they apply to.</p>
<p>这些段落如下：</p>
<dl class="std confsec">
<dt class="sig sig-object std" id="confsec-global">
<span class="sig-name descname"><span class="pre">global</span></span><a class="headerlink" href="#confsec-global" title="Permalink to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">global</span></code> 下的配置选项影响 Ceph 存储集群里的所有守护进程和客户端。</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">log_file</span> <span class="pre">=</span> <span class="pre">/var/log/ceph/$cluster-$type.$id.log</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt class="sig sig-object std" id="confsec-mon">
<span class="sig-name descname"><span class="pre">mon</span></span><a class="headerlink" href="#confsec-mon" title="Permalink to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">mon</span></code> 下的配置影响 Ceph 集群里的所有 <code class="docutils literal notranslate"><span class="pre">ceph-mon</span></code> 守护进程，
并且会覆盖 <code class="docutils literal notranslate"><span class="pre">global</span></code> 下的同一选项。</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">mon_cluster_log_to_syslog</span> <span class="pre">=</span> <span class="pre">true</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt class="sig sig-object std" id="confsec-mgr">
<span class="sig-name descname"><span class="pre">mgr</span></span><a class="headerlink" href="#confsec-mgr" title="Permalink to this definition"></a></dt>
<dd><p>Settings in the <code class="docutils literal notranslate"><span class="pre">mgr</span></code> section affect all <code class="docutils literal notranslate"><span class="pre">ceph-mgr</span></code> daemons in
the Ceph Storage Cluster, and override the same setting in
<code class="docutils literal notranslate"><span class="pre">global</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">mgr_stats_period</span> <span class="pre">=</span> <span class="pre">10</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt class="sig sig-object std" id="confsec-osd">
<span class="sig-name descname"><span class="pre">osd</span></span><a class="headerlink" href="#confsec-osd" title="Permalink to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">osd</span></code> 下的配置影响 Ceph 存储集群里的所有 <code class="docutils literal notranslate"><span class="pre">ceph-osd</span></code> 守护进程，
并且会覆盖 <code class="docutils literal notranslate"><span class="pre">global</span></code> 下的同一选项。</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">osd_op_queue</span> <span class="pre">=</span> <span class="pre">wpq</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt class="sig sig-object std" id="confsec-mds">
<span class="sig-name descname"><span class="pre">mds</span></span><a class="headerlink" href="#confsec-mds" title="Permalink to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">mds</span></code> 下的配置影响 Ceph 存储集群里的所有 <code class="docutils literal notranslate"><span class="pre">ceph-mds</span></code>
守护进程，并且会覆盖 <code class="docutils literal notranslate"><span class="pre">global</span></code> 下的同一选项。</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">mds_cache_memory_limit</span> <span class="pre">=</span> <span class="pre">10G</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt class="sig sig-object std" id="confsec-client">
<span class="sig-name descname"><span class="pre">client</span></span><a class="headerlink" href="#confsec-client" title="Permalink to this definition"></a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">[client]</span></code> 下的配置影响所有 Ceph 客户端
（如挂载的 Ceph 文件系统、挂载的块设备等等）、
也影响 Rados 网关（ RGW ）守护进程。</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">objecter_inflight_ops</span> <span class="pre">=</span> <span class="pre">512</span></code></p>
</dd>
</dl>
</dd></dl>

<p>Configuration sections can also specify an individual daemon or client name. For example,
<code class="docutils literal notranslate"><span class="pre">mon.foo</span></code>, <code class="docutils literal notranslate"><span class="pre">osd.123</span></code>, and <code class="docutils literal notranslate"><span class="pre">client.smith</span></code> are all valid section names.</p>
<p>Any given daemon will draw its settings from the global section, the daemon- or
client-type section, and the section sharing its name. Settings in the
most-specific section take precedence so precedence: for example, if the same
option is specified in both <a class="reference internal" href="#confsec-global"><code class="xref std std-confsec docutils literal notranslate"><span class="pre">global</span></code></a>, <a class="reference internal" href="#confsec-mon"><code class="xref std std-confsec docutils literal notranslate"><span class="pre">mon</span></code></a>, and <code class="docutils literal notranslate"><span class="pre">mon.foo</span></code>
on the same source (i.e. that is, in the same configuration file), the
<code class="docutils literal notranslate"><span class="pre">mon.foo</span></code> setting will be used.</p>
<p>If multiple values of the same configuration option are specified in the same
section, the last value specified takes precedence.</p>
<p>Note that values from the local configuration file always take precedence over
values from the monitor configuration database, regardless of the section in
which they appear.</p>
</section>
<section id="ceph-metavariables">
<span id="id6"></span><h2>元变量<a class="headerlink" href="#ceph-metavariables" title="Permalink to this heading"></a></h2>
<p>元变量大大简化了 Ceph 集群配置。如果在配置值里设置了元变量，
Ceph 会在使用此配置值时把相应的元变量展开为具体值。Ceph 元变量类似于 Bash shell 的变量展开。</p>
<p>Ceph 支持下列元变量：</p>
<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">$cluster</span></span></dt>
<dd><p>展开为存储集群的名字，
在同一套硬件上运行多个集群时有用。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/etc/ceph/$cluster.keyring</span></code>
:default:<code class="docutils literal notranslate"><span class="pre">ceph</span></code></p>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">$type</span></span></dt>
<dd><p>可展开为守护进程或进程类型，如 <code class="docutils literal notranslate"><span class="pre">mds</span></code> 、 <code class="docutils literal notranslate"><span class="pre">osd</span></code> 、 <code class="docutils literal notranslate"><span class="pre">mon</span></code> 。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/var/lib/ceph/$type</span></code></p>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">$id</span></span></dt>
<dd><p>展开为守护进程或客户端标识符；
<code class="docutils literal notranslate"><span class="pre">osd.0</span></code> 应为 <code class="docutils literal notranslate"><span class="pre">0</span></code> ， <code class="docutils literal notranslate"><span class="pre">mds.a</span></code> 是 <code class="docutils literal notranslate"><span class="pre">a</span></code> 。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/var/lib/ceph/$type/$cluster-$id</span></code></p>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">$host</span></span></dt>
<dd><p>展开为当前守护进程的主机名。</p>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">$name</span></span></dt>
<dd><p>展开为 <code class="docutils literal notranslate"><span class="pre">$type.$id</span></code> 。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/var/run/ceph/$cluster-$name.asok</span></code></p>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">$pid</span></span></dt>
<dd><p>展开为守护进程的 pid 。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/var/run/ceph/$cluster-$name-$pid.asok</span></code></p>
</dd></dl>

</section>
<section id="id7">
<h2>Ceph 配置文件<a class="headerlink" href="#id7" title="Permalink to this heading"></a></h2>
<p>启动时， Ceph 的各进程会依次到下列位置搜索配置文件：</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$CEPH_CONF</span></code> （<em>就是</em> <code class="docutils literal notranslate"><span class="pre">$CEPH_CONF</span></code> 环境变量所指示的路径）；</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-c</span> <span class="pre">path/path</span></code>  （<em>就是</em> <code class="docutils literal notranslate"><span class="pre">-c</span></code> 命令行参数）；</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">/etc/ceph/$cluster.conf</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">~/.ceph/$cluster.conf</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">./$cluster.conf</span></code> （<em>就是</em>当前的工作路径）。</p></li>
<li><p>对 FreeBSD 而言， <code class="docutils literal notranslate"><span class="pre">/usr/local/etc/ceph/$cluster.conf</span></code></p></li>
</ol>
<p>其中， <code class="docutils literal notranslate"><span class="pre">$cluster</span></code> 代表集群名（默认为 <code class="docutils literal notranslate"><span class="pre">ceph</span></code> ）。</p>
<p>Ceph 配置文件使用 <em>ini</em> 风格的语法，以分号 (;) 和井号 (#) 开始的行是注释，如下：</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="c1"># &lt;--A number (#) sign precedes a comment.</span>
<span class="c1">; A comment may be anything.</span>
<span class="c1"># Comments always follow a semi-colon (;) or a pound (#) on each line.</span>
<span class="c1"># The end of the line terminates a comment.</span>
<span class="c1"># We recommend that you provide comments in your configuration file(s).</span>
</pre></div>
</div>
</section>
<section id="ceph-conf-settings">
<span id="id8"></span><h2>配置文件段落<a class="headerlink" href="#ceph-conf-settings" title="Permalink to this heading"></a></h2>
<p>The configuration file is divided into sections. Each section must begin with a
valid configuration section name (see <a class="reference internal" href="#id5">配置段落</a>, above)
surrounded by square brackets. For example,</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[global]</span>
<span class="na">debug ms</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0</span>

<span class="k">[osd]</span>
<span class="na">debug ms</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1</span>

<span class="k">[osd.1]</span>
<span class="na">debug ms</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">10</span>

<span class="k">[osd.2]</span>
<span class="na">debug ms</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">10</span>
</pre></div>
</div>
<section id="id9">
<h3>配置文件选项的值<a class="headerlink" href="#id9" title="Permalink to this heading"></a></h3>
<p>The value of a configuration option is a string. If the string is too long to
fit on a single line, you can put a backslash (<code class="docutils literal notranslate"><span class="pre">\</span></code>) at the end of the line
and the backslash will act as a line continuation marker. In such a case, the
value of the option will be the string after <code class="docutils literal notranslate"><span class="pre">=</span></code> in the current line,
combined with the string in the next line. Here is an example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="k">global</span><span class="p">]</span>
<span class="n">foo</span> <span class="o">=</span> <span class="n">long</span> <span class="n">long</span> <span class="n">ago</span>\
<span class="n">long</span> <span class="n">ago</span>
</pre></div>
</div>
<p>In this example, the value of the “<code class="docutils literal notranslate"><span class="pre">foo</span></code>” option is “<code class="docutils literal notranslate"><span class="pre">long</span> <span class="pre">long</span> <span class="pre">ago</span> <span class="pre">long</span>
<span class="pre">ago</span></code>”.</p>
<p>An option value typically ends with either a newline or a comment. For
example:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[global]</span>
<span class="na">obscure one</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">difficult to explain</span><span class="w"> </span><span class="c1"># I will try harder in next release</span>
<span class="na">simpler one</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">nothing to explain</span>
</pre></div>
</div>
<p>In this example, the value of the “<code class="docutils literal notranslate"><span class="pre">obscure</span> <span class="pre">one</span></code>” option is “<code class="docutils literal notranslate"><span class="pre">difficult</span> <span class="pre">to</span>
<span class="pre">explain</span></code>” and the value of the “<code class="docutils literal notranslate"><span class="pre">simpler</span> <span class="pre">one</span></code> options is “<code class="docutils literal notranslate"><span class="pre">nothing</span> <span class="pre">to</span>
<span class="pre">explain</span></code>”.</p>
<p>When an option value contains spaces, it can be enclosed within single quotes
or double quotes in order to make its scope clear and in order to make sure
that the first space in the value is not interpreted as the end of the value.
For example:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[global]</span>
<span class="na">line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;to be, or not to be&quot;</span>
</pre></div>
</div>
<p>In option values, there are four characters that are treated as escape
characters: <code class="docutils literal notranslate"><span class="pre">=</span></code>, <code class="docutils literal notranslate"><span class="pre">#</span></code>, <code class="docutils literal notranslate"><span class="pre">;</span></code> and <code class="docutils literal notranslate"><span class="pre">[</span></code>. They are permitted to occur in an
option value only if they are immediately preceded by the backslash character
(<code class="docutils literal notranslate"><span class="pre">\</span></code>). For example:</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[global]</span>
<span class="na">secret</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;i love \</span><span class="c1"># and \[&quot;</span>
</pre></div>
</div>
<p>Every configuration option is typed with one of the types below:</p>
<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">int</span></span></dt>
<dd><p>64-bit signed integer. Some SI suffixes are supported, such as “K”, “M”,
“G”, “T”, “P”, and “E” (meaning, respectively, 10<sup>3</sup>, 10<sup>6</sup>,
10<sup>9</sup>, etc.). “B” is the only supported unit string. Thus “1K”, “1M”,
“128B” and “-1” are all valid option values. When a negative value is
assigned to a threshold option, this can indicate that the option is
“unlimited” -- that is, that there is no threshold or limit in effect.</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">42</span></code>, <code class="docutils literal notranslate"><span class="pre">-1</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">uint</span></span></dt>
<dd><p>This differs from <code class="docutils literal notranslate"><span class="pre">integer</span></code> only in that negative values are not
permitted.</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">256</span></code>, <code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">str</span></span></dt>
<dd><p>A string encoded in UTF-8. Certain characters are not permitted. Reference
the above notes for the details.</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">&quot;hello</span> <span class="pre">world&quot;</span></code>, <code class="docutils literal notranslate"><span class="pre">&quot;i</span> <span class="pre">love</span> <span class="pre">\#&quot;</span></code>, <code class="docutils literal notranslate"><span class="pre">yet-another-name</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">boolean</span></span></dt>
<dd><p>Typically either of the two values <code class="docutils literal notranslate"><span class="pre">true</span></code> or <code class="docutils literal notranslate"><span class="pre">false</span></code>. However, any
integer is permitted: “0” implies <code class="docutils literal notranslate"><span class="pre">false</span></code>, and any non-zero value implies
<code class="docutils literal notranslate"><span class="pre">true</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">true</span></code>, <code class="docutils literal notranslate"><span class="pre">false</span></code>, <code class="docutils literal notranslate"><span class="pre">1</span></code>, <code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">addr</span></span></dt>
<dd><p>A single address, optionally prefixed with <code class="docutils literal notranslate"><span class="pre">v1</span></code>, <code class="docutils literal notranslate"><span class="pre">v2</span></code> or <code class="docutils literal notranslate"><span class="pre">any</span></code> for the
messenger protocol. If no prefix is specified, the <code class="docutils literal notranslate"><span class="pre">v2</span></code> protocol is used.
For more details, see <a class="reference internal" href="../msgr2/#address-formats"><span class="std std-ref">地址格式</span></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">v1:1.2.3.4:567</span></code>, <code class="docutils literal notranslate"><span class="pre">v2:1.2.3.4:567</span></code>, <code class="docutils literal notranslate"><span class="pre">1.2.3.4:567</span></code>, <code class="docutils literal notranslate"><span class="pre">2409:8a1e:8fb6:aa20:1260:4bff:fe92:18f5::567</span></code>, <code class="docutils literal notranslate"><span class="pre">[::1]:6789</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">addrvec</span></span></dt>
<dd><p>A set of addresses separated by “,”. The addresses can be optionally quoted
with <code class="docutils literal notranslate"><span class="pre">[</span></code> and <code class="docutils literal notranslate"><span class="pre">]</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">[v1:1.2.3.4:567,v2:1.2.3.4:568]</span></code>, <code class="docutils literal notranslate"><span class="pre">v1:1.2.3.4:567,v1:1.2.3.14:567</span></code>  <code class="docutils literal notranslate"><span class="pre">[2409:8a1e:8fb6:aa20:1260:4bff:fe92:18f5::567],</span> <span class="pre">[2409:8a1e:8fb6:aa20:1260:4bff:fe92:18f5::568]</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">uuid</span></span></dt>
<dd><p>The string format of a uuid defined by <a class="reference external" href="https://www.ietf.org/rfc/rfc4122.txt">RFC4122</a>. Certain variants are also
supported: for more details, see <a class="reference external" href="https://www.boost.org/doc/libs/1_74_0/libs/uuid/doc/uuid.html#String%20Generator">Boost document</a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">f81d4fae-7dec-11d0-a765-00a0c91e6bf6</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">size</span></span></dt>
<dd><p>64-bit unsigned integer. Both SI prefixes and IEC prefixes are supported.
“B” is the only supported unit string. Negative values are not permitted.</p>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1Ki</span></code>, <code class="docutils literal notranslate"><span class="pre">1K</span></code>, <code class="docutils literal notranslate"><span class="pre">1KiB</span></code> and <code class="docutils literal notranslate"><span class="pre">1B</span></code>.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt class="sig sig-object">
<span class="sig-name descname"><span class="pre">secs</span></span></dt>
<dd><p>Denotes a duration of time. The default unit of time is the second.
The following units of time are supported:</p>
<blockquote>
<div><ul class="simple">
<li><p>second: “s”, “sec”, “second”, “seconds”</p></li>
<li><p>minute: “m”, “min”, “minute”, “minutes”</p></li>
<li><p>hour: “hs”, “hr”, “hour”, “hours”</p></li>
<li><p>day: “d”, “day”, “days”</p></li>
<li><p>week: “w”, “wk”, “week”, “weeks”</p></li>
<li><p>month: “mo”, “month”, “months”</p></li>
<li><p>year: “y”, “yr”, “year”, “years”</p></li>
</ul>
</div></blockquote>
<dl class="field-list simple">
<dt class="field-odd">Example<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span> <span class="pre">m</span></code>, <code class="docutils literal notranslate"><span class="pre">1m</span></code> and <code class="docutils literal notranslate"><span class="pre">1</span> <span class="pre">week</span></code></p>
</dd>
</dl>
</dd></dl>

</section>
</section>
<section id="ceph-conf-database">
<span id="id10"></span><h2>监视器配置数据库<a class="headerlink" href="#ceph-conf-database" title="Permalink to this heading"></a></h2>
<p>The monitor cluster manages a database of configuration options that can be
consumed by the entire cluster. This allows for streamlined central
configuration management of the entire system. For ease of administration and
transparency, the vast majority of configuration options can and should be
stored in this database.</p>
<p>Some settings might need to be stored in local configuration files because they
affect the ability of the process to connect to the monitors, to authenticate,
and to fetch configuration information. In most cases this applies only to the
<code class="docutils literal notranslate"><span class="pre">mon_host</span></code> option. This issue can be avoided by using <a class="reference internal" href="../mon-lookup-dns/#mon-dns-lookup"><span class="std std-ref">DNS SRV
records</span></a>.</p>
<section id="id11">
<h3>段落和掩码<a class="headerlink" href="#id11" title="Permalink to this heading"></a></h3>
<p>Configuration options stored by the monitor can be stored in a global section,
in a daemon-type section, or in a specific daemon section. In this, they are
no different from the options in a configuration file.</p>
<p>In addition, options may have a <em>mask</em> associated with them to further restrict
which daemons or clients the option applies to. Masks take two forms:</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">type:location</span></code> where <code class="docutils literal notranslate"><span class="pre">type</span></code> is a CRUSH property like <code class="docutils literal notranslate"><span class="pre">rack</span></code> or
<code class="docutils literal notranslate"><span class="pre">host</span></code>, and <code class="docutils literal notranslate"><span class="pre">location</span></code> is a value for that property. For example,
<code class="docutils literal notranslate"><span class="pre">host:foo</span></code> would limit the option only to daemons or clients
running on a particular host.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">class:device-class</span></code> where <code class="docutils literal notranslate"><span class="pre">device-class</span></code> is the name of a CRUSH
device class (for example, <code class="docutils literal notranslate"><span class="pre">hdd</span></code> or <code class="docutils literal notranslate"><span class="pre">ssd</span></code>). For example,
<code class="docutils literal notranslate"><span class="pre">class:ssd</span></code> would limit the option only to OSDs backed by SSDs.
(This mask has no effect on non-OSD daemons or clients.)</p></li>
</ol>
<p>In commands that specify a configuration option, the argument of the option (in
the following examples, this is the “who” string) may be a section name, a
mask, or a combination of both separated by a slash character (<code class="docutils literal notranslate"><span class="pre">/</span></code>). For
example, <code class="docutils literal notranslate"><span class="pre">osd/rack:foo</span></code> would refer to all OSD daemons in the <code class="docutils literal notranslate"><span class="pre">foo</span></code> rack.</p>
<p>When configuration options are shown, the section name and mask are presented
in separate fields or columns to make them more readable.</p>
</section>
<section id="id12">
<h3>命令<a class="headerlink" href="#id12" title="Permalink to this heading"></a></h3>
<p>The following CLI commands are used to configure the cluster:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">dump</span></code> dumps the entire monitor configuration
database for the cluster.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">get</span> <span class="pre">&lt;who&gt;</span></code> dumps the configuration options stored in
the monitor configuration database for a specific daemon or client
(for example, <code class="docutils literal notranslate"><span class="pre">mds.a</span></code>).</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">get</span> <span class="pre">&lt;who&gt;</span> <span class="pre">&lt;option&gt;</span></code> shows either a configuration value
stored in the monitor configuration database for a specific daemon or client
(for example, <code class="docutils literal notranslate"><span class="pre">mds.a</span></code>), or, if that value is not present in the monitor
configuration database, the compiled-in default value.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">set</span> <span class="pre">&lt;who&gt;</span> <span class="pre">&lt;option&gt;</span> <span class="pre">&lt;value&gt;</span></code> specifies a configuration
option in the monitor configuration database.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">show</span> <span class="pre">&lt;who&gt;</span></code> shows the configuration for a running daemon.
These settings might differ from those stored by the monitors if there are
also local configuration files in use or if options have been overridden on
the command line or at run time. The source of the values of the options is
displayed in the output.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">assimilate-conf</span> <span class="pre">-i</span> <span class="pre">&lt;input</span> <span class="pre">file&gt;</span> <span class="pre">-o</span> <span class="pre">&lt;output</span> <span class="pre">file&gt;</span></code> ingests a
configuration file from <em>input file</em> and moves any valid options into the
monitor configuration database. Any settings that are unrecognized, are
invalid, or cannot be controlled by the monitor will be returned in an
abbreviated configuration file stored in <em>output file</em>. This command is
useful for transitioning from legacy configuration files to centralized
monitor-based configuration.</p></li>
</ul>
<p>Note that <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">set</span> <span class="pre">&lt;who&gt;</span> <span class="pre">&lt;option&gt;</span> <span class="pre">&lt;value&gt;</span></code> and <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">get</span>
<span class="pre">&lt;who&gt;</span> <span class="pre">&lt;option&gt;</span></code> will not necessarily return the same values. The latter
command will show compiled-in default values. In order to determine whether a
configuration option is present in the monitor configuration database, run
<code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">dump</span></code>.</p>
</section>
</section>
<section id="id13">
<h2>帮助信息<a class="headerlink" href="#id13" title="Permalink to this heading"></a></h2>
<p>To get help for a particular option, run the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "$ ";
}
</style><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">help</span><span class="w"> </span>&lt;option&gt;</span>
</pre></div></div><p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">help</span><span class="w"> </span>log_file</span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span>log_file - path to log file
 (std::string, basic)
 Default (non-daemon):
 Default (daemon): /var/log/ceph/$cluster-$name.log
 Can update at runtime: false
 See also: [log_to_stderr,err_to_stderr,log_to_syslog,err_to_syslog]
</pre></div>
</div>
<p>或者：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">help</span><span class="w"> </span>log_file<span class="w"> </span>-f<span class="w"> </span>json-pretty</span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;log_file&quot;</span><span class="p">,</span>
    <span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;std::string&quot;</span><span class="p">,</span>
    <span class="s2">&quot;level&quot;</span><span class="p">:</span> <span class="s2">&quot;basic&quot;</span><span class="p">,</span>
    <span class="s2">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;path to log file&quot;</span><span class="p">,</span>
    <span class="s2">&quot;long_desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
    <span class="s2">&quot;default&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
    <span class="s2">&quot;daemon_default&quot;</span><span class="p">:</span> <span class="s2">&quot;/var/log/ceph/$cluster-$name.log&quot;</span><span class="p">,</span>
    <span class="s2">&quot;tags&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;services&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;see_also&quot;</span><span class="p">:</span> <span class="p">[</span>
        <span class="s2">&quot;log_to_stderr&quot;</span><span class="p">,</span>
        <span class="s2">&quot;err_to_stderr&quot;</span><span class="p">,</span>
        <span class="s2">&quot;log_to_syslog&quot;</span><span class="p">,</span>
        <span class="s2">&quot;err_to_syslog&quot;</span>
    <span class="p">],</span>
    <span class="s2">&quot;enum_values&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;min&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
    <span class="s2">&quot;max&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
    <span class="s2">&quot;can_update_at_runtime&quot;</span><span class="p">:</span> <span class="n">false</span>
<span class="p">}</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">level</span></code> property can be <code class="docutils literal notranslate"><span class="pre">basic</span></code>, <code class="docutils literal notranslate"><span class="pre">advanced</span></code>, or <code class="docutils literal notranslate"><span class="pre">dev</span></code>.  The <cite>dev</cite>
options are intended for use by developers, generally for testing purposes, and
are not recommended for use by operators.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This command uses the configuration schema that is compiled into the
running monitors. If you have a mixed-version cluster (as might exist, for
example, during an upgrade), you might want to query the option schema from
a specific running daemon by running a command of the following form:</p>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>daemon<span class="w"> </span>&lt;name&gt;<span class="w"> </span>config<span class="w"> </span><span class="nb">help</span><span class="w"> </span><span class="o">[</span>option<span class="o">]</span></span>
</pre></div></div></section>
<section id="id14">
<h2>运行时改配置<a class="headerlink" href="#id14" title="Permalink to this heading"></a></h2>
<p>大多数情况下， Ceph 都允许在运行时更改守护进程的配置。此功能在增加/降低日志输出、启用/禁用调试设置、甚至是运行时优化的时候非常有用。</p>
<p>Use the <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">set</span></code> command to update configuration options. For
example, to enable the most verbose  debug log level on a specific OSD, run a
command of the following form:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>osd.123<span class="w"> </span>debug_ms<span class="w"> </span><span class="m">20</span></span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>If an option has been customized in a local configuration file, the
<a class="reference external" href="https://ceph.io/en/news/blog/2018/new-mimic-centralized-configuration-management/">central config</a>
setting will be ignored because it has a lower priority than the local
configuration file.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Log levels range from 0 to 20.</p>
</div>
<section id="id15">
<h3>覆盖值<a class="headerlink" href="#id15" title="Permalink to this heading"></a></h3>
<p>Options can be set temporarily by using the Ceph CLI <code class="docutils literal notranslate"><span class="pre">tell</span></code> or <code class="docutils literal notranslate"><span class="pre">daemon</span></code>
interfaces on the Ceph CLI. These <em>override</em> values are ephemeral, which means
that they affect only the current instance of the daemon and revert to
persistently configured values when the daemon restarts.</p>
<p>Override values can be set in two ways:</p>
<ol class="arabic">
<li><p>From any host, send a message to a daemon with a command of the following
form:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>&lt;name&gt;<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>&lt;option&gt;<span class="w"> </span>&lt;value&gt;</span>
</pre></div></div><p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>osd.123<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>debug_osd<span class="w"> </span><span class="m">20</span></span>
</pre></div></div><p>The <code class="docutils literal notranslate"><span class="pre">tell</span></code> command can also accept a wildcard as the daemon identifier.
For example, to adjust the debug level on all OSD daemons, run a command of
the following form:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>tell<span class="w"> </span>osd.*<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>debug_osd<span class="w"> </span><span class="m">20</span></span>
</pre></div></div></li>
<li><p>On the host where the daemon is running, connect to the daemon via a socket
in <code class="docutils literal notranslate"><span class="pre">/var/run/ceph</span></code> by running a command of the following form:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>daemon<span class="w"> </span>&lt;name&gt;<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>&lt;option&gt;<span class="w"> </span>&lt;value&gt;</span>
</pre></div></div><p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>daemon<span class="w"> </span>osd.4<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>debug_osd<span class="w"> </span><span class="m">20</span></span>
</pre></div></div></li>
</ol>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>In the output of the <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">show</span></code> command, these temporary
values are shown to have a source of <code class="docutils literal notranslate"><span class="pre">override</span></code>.</p>
</div>
</section>
</section>
<section id="id16">
<h2>查看运行时配置<a class="headerlink" href="#id16" title="Permalink to this heading"></a></h2>
<p>You can see the current settings specified for a running daemon with the <code class="docutils literal notranslate"><span class="pre">ceph</span>
<span class="pre">config</span> <span class="pre">show</span></code> command. For example, to see the (non-default) settings for the
daemon <code class="docutils literal notranslate"><span class="pre">osd.0</span></code>, run the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span>show<span class="w"> </span>osd.0</span>
</pre></div></div><p>To see a specific setting, run the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span>show<span class="w"> </span>osd.0<span class="w"> </span>debug_osd</span>
</pre></div></div><p>To see all settings (including those with default values), run the following
command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span>show-with-defaults<span class="w"> </span>osd.0</span>
</pre></div></div><p>You can see all settings for a daemon that is currently running by connecting
to it on the local host via the admin socket. For example, to dump all
current settings, run the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>daemon<span class="w"> </span>osd.0<span class="w"> </span>config<span class="w"> </span>show</span>
</pre></div></div><p>To see non-default settings and to see where each value came from (for example,
a config file, the monitor, or an override), run the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>daemon<span class="w"> </span>osd.0<span class="w"> </span>config<span class="w"> </span>diff</span>
</pre></div></div><p>To see the value of a single setting, run the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>daemon<span class="w"> </span>osd.0<span class="w"> </span>config<span class="w"> </span>get<span class="w"> </span>debug_osd</span>
</pre></div></div></section>
<section id="octopus">
<h2>Octopus 版发生的变化<a class="headerlink" href="#octopus" title="Permalink to this heading"></a></h2>
<p>Octopus 版改变了配置文件的分析方式，改变的地方有：</p>
<ul>
<li><p>Repeated configuration options are allowed, and no warnings will be
displayed. This means that the setting that comes last in the file is the one
that takes effect. Prior to this change, Ceph displayed warning messages when
lines containing duplicate options were encountered, such as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">warning</span> <span class="n">line</span> <span class="mi">42</span><span class="p">:</span> <span class="s1">&#39;foo&#39;</span> <span class="ow">in</span> <span class="n">section</span> <span class="s1">&#39;bar&#39;</span> <span class="n">redefined</span>
</pre></div>
</div>
</li>
<li><p>Prior to Octopus, options containing invalid UTF-8 characters were ignored
with warning messages. But in Octopus, they are treated as fatal errors.</p></li>
<li><p>The backslash character <code class="docutils literal notranslate"><span class="pre">\</span></code> is used as the line-continuation marker that
combines the next line with the current one. Prior to Octopus, there was a
requirement that any end-of-line backslash be followed by a non-empty line.
But in Octopus, an empty line following a backslash is allowed.</p></li>
<li><p>In the configuration file, each line specifies an individual configuration
option. The option’s name and its value are separated with <code class="docutils literal notranslate"><span class="pre">=</span></code>, and the
value may be enclosed within single or double quotes. If an invalid
configuration is specified, we will treat it as an invalid configuration
file:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">bad</span> <span class="n">option</span> <span class="o">====</span> <span class="n">bad</span> <span class="n">value</span>
</pre></div>
</div>
</li>
<li><p>Prior to Octopus, if no section name was specified in the configuration file,
all options would be set as though they were within the <a class="reference internal" href="#confsec-global"><code class="xref std std-confsec docutils literal notranslate"><span class="pre">global</span></code></a>
section. This approach is discouraged. Since Octopus, any configuration
file that has no section name must contain only a single option.</p></li>
</ul>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../storage-devices/" class="btn btn-neutral float-left" title="存储设备" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../common/" class="btn btn-neutral float-right" title="通用选项" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>